﻿<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>BingoDebug</title>
<meta name="viewport" content="initial-scale=1,user-scalable=no">
<link rel="stylesheet" href="jquery.mobile-1.1.0.min.css" />
<link rel="stylesheet" href="BingoTouch.css" />
<script src="jquery-1.7.1.min.js"></script>
<script src="jquery.mobile-1.1.0.min.js"></script>
<script src="BingoTouch.js"></script>
<script>
	var BASEURL = "http://mobileone.bingosoft.net/";
	var APKID = BASEURL + "services/rest/product/product/4ac7a490-3a92-4aa5-abc8-dad533dc8b9d";
	BingoTouch.init = function(){
		
	}
	BingoTouch.ready = function(){
		$("#main").css("height", (BingoTouch.WebView.height()-180)+"px");
		
		$("#version").html("当前版本：" + BingoTouch.App.getVersionName() + " [" + BingoTouch.App.getVersionCode() + "]");
		$("#checkVersion").tap(function(e){
			BingoTouch.WebView.wait(true);
			BingoTouch.Common.WebRequest(APKID,"GET","application/json",null,true,GetNewVersion,onErr);
		});
	}
	function GetNewVersion(r){
		if (r.exProperties.VersionCode > BingoTouch.App.getVersionCode()){
			if (BingoTouch.Common.confirm("BingoDebug最新版本为" + r.version + "，请点击确定进行应用更新。")){
				BingoTouch.App.download(BASEURL + r.exProperties.APKUrl,"应用开始下载...",r.name);
				BingoTouch.Common.alert(r.name + '已经在下载中，下载完成后会提醒您安装。');
			}
		}else{
			BingoTouch.Common.alert("当前已经是最新版本。");
		}
		BingoTouch.WebView.wait(false);
	}
	function onErr(r){alert(r); BingoTouch.WebView.wait(false);}
</script>
</head>
<body style="background:none;">
	<table width="100%" id="main">
    	<tr>
        	<td valign="bottom" align="center">
                <span style="height:20px;color:white;" id="version"></span><br><br>
				<div id="checkVersion" data-role="BTButton" style="width:200px;">检查更新</div>
            </td>
        </tr>
    </table>
</body>
</html>